import 'package:enterprise_v8/app/components/custom_app_bar.dart';
import 'package:enterprise_v8/app/components/custom_modele/clearable_text_field%20.dart';
import 'package:enterprise_v8/app/components/toast_widget.dart';
import 'package:enterprise_v8/app/core/core.dart';

import 'setting_password_controller.dart';

///设置密码
class SettingPasswordPage extends StatelessWidget {
  SettingPasswordPage({super.key});

  final controller = Get.put(SettingPasswordController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar(
        title: Text(
          '设置新密码',
          style: TextStyles.black_18,
        ),
      ),
      body: GetBuilder(
        init: controller,
        builder: (_) {
          return bodyContent();
        },
      ),
      bottomSheet: Container(
        padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 5.w),
        decoration: BoxDecoration(
          color: Colors.white,
          boxShadow: [
            BoxShadow(
              color: const Color(0xffBCBCC5).withOpacity(0.3), // 阴影颜色
              offset: const Offset(0, -5), // 阴影的偏移量，向上偏移，即上方阴影
              blurRadius: 10.0, // 阴影的模糊半径
              spreadRadius: 2.0, // 阴影的扩散半径
            ),
          ],
        ),
        child: Row(
          children: [
            Expanded(
              child: ElevatedButton(
                style: ElevatedButton.styleFrom(
                  backgroundColor: AppColors.blue_button,
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(22.r),
                  ),
                ),
                onPressed: controller.complete,
                child: Text(
                  '确定',
                  style: TextStyle(
                    fontSize: 16.sp,
                    color: Colors.white,
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }

  Widget bodyContent() {
    return Padding(
      padding: EdgeInsets.only(left: 25.w, top: 50.w, right: 25.w),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            '设置新密码',
            style: TextStyle(
              color: Colors.black,
              fontSize: 20.sp,
            ),
          ),
          Text(
            '新密码至少8个字符,不能是全是字母数字',
            style: TextStyle(
              color: Colors.blueAccent,
              fontSize: 12.sp,
            ),
          ),
          AppGaps.vGap20,
          Text(
            '旧密码',
            style: TextStyle(
              color: Colors.black,
              fontSize: 20.sp,
            ),
          ),
          AppGaps.vGap10,
          MultifunctionalClearTextField(
            contentPadding: const EdgeInsets.only(left: 8, top: 8),
            suffixIcon: true,
            softKeyboard: false,
            text: '123456',
            node: controller.nodeOldPassword,
            clickOnce: controller.iconClick,
            onChangedValue: (value) {
              AppToast.showSuccess(value);
            },
          ),
          AppGaps.vGap20,
          Text(
            '新密码',
            style: TextStyle(
              color: Colors.black,
              fontSize: 20.sp,
            ),
          ),
          AppGaps.vGap10,
          MultifunctionalClearTextField(
            contentPadding: const EdgeInsets.only(left: 8, top: 8),
            suffixIcon: true,
            softKeyboard: false,
            text: '123456',
            node: controller.nodePassword,
            clickOnce: controller.iconClick,
            onChangedValue: (value) {
              AppToast.showSuccess(value);
            },
          ),
          AppGaps.vGap20,
          Text(
            '确认新密码',
            style: TextStyle(
              color: Colors.black,
              fontSize: 20.sp,
            ),
          ),
          AppGaps.vGap10,
          MultifunctionalClearTextField(
            contentPadding: const EdgeInsets.only(left: 8, top: 8),
            suffixIcon: true,
            softKeyboard: false,
            text: '123456',
            node: controller.nodeNewPassword,
            clickOnce: controller.iconClick,
            onChangedValue: (value) {
              AppToast.showSuccess(value);
            },
          ),
        ],
      ),
    );
  }
}
